package controllers;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import admin.models.MetaSeoModel;

import models.PageModel;

import systems.ConfigSystem;

import entities.MetaSeo;
import entities.Page;
import entities.SiteConfig;

@SuppressWarnings("serial")
public class PrivacyServlet extends HttpServlet {
	public void doGet(HttpServletRequest request, HttpServletResponse response)
		throws IOException, ServletException {
		
		SiteConfig config = ConfigSystem.getConfigs();
		
		PageModel pageModel = PageModel.getInstance();
		Page privacy = pageModel.getPrivacyPolicy();
		
		//Set seo content
		MetaSeoModel metaseoModel = MetaSeoModel.getInstance();
		MetaSeo metaseo = metaseoModel.get("privacy");
		
		request.setAttribute("staticPage", privacy);
		request.setAttribute("metaseo", metaseo);
		try {
			request.getRequestDispatcher("/templates/" + config.getTemplate() + "/pages/static_page.jsp").forward(request, response);
		} catch (ServletException e) {
			//e.printStackTrace();
		}
	}
}
